﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using CE.Board;
using CE.User;

public partial class board_list_question : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //if (Session[CE.Global.General.BoardId] != null)
            //{
            //    liAnswer.Style.Add("display", "");
            //}

            if (Request.QueryString["say"] != null)
            {
                if (Request.QueryString["say"] == "thanks") lblMessage.Text = "Thank you.";
            }

            GetResult();
        }
        else
        {
            lblMessage.Text = "";
        }
    }

    #region Result

    private void GetResult()
    {
        try
        {
            grdResult.DataSource = null;
            grdResult.DataBind();

            BoardDB objBoardDB = new BoardDB();
            DataTable _dt = objBoardDB.GetBoard(txtSearch.Text.Trim(), 1, "", "", "");

            grdResult.DataSource = _dt;
            grdResult.DataBind();
        }
        catch (Exception)
        {
        }
    }

    protected void grdResult_Change(Object sender, DataGridPageChangedEventArgs e)
    {
        grdResult.CurrentPageIndex = e.NewPageIndex;
        GetResult();
    }

    #endregion

    protected void btnSearch_Click(object sender, ImageClickEventArgs e)
    {
        grdResult.CurrentPageIndex = 0;
        GetResult();
    }
}
